<%@ include file="/WEB-INF/jsp/include.jsp"%>

<c:url var="avatar_png" value="/img/avatar_male.png" />
<div class="media">


	<a class="pull-left" href="#"> <img src="${avatar_png}" class="media-object">
	</a>
	<div class="media-body">
		<h4 class="media-heading">${user.userName}</h4>
		User data details...
		<!-- Nested media object -->
		<div class="media">
			<b>Email:</b> ${user.email}<br /> 
			<b>SigninDate:</b> ${user.signinDate}<br /> 
			<b>Status:</b> ${user.enabled}<br />
			<b>Money:</b> ${user.money}<br />
			
			<sec:authorize access="hasRole('ROLE_ADMIN')">
			   <div id="userRoleProfile" style="display:inline" >
			    <b>Role:</b> ${user.roleName} 
			    <c:if test="${not empty roles}" >     
			         <c:url var="changeRoleUser" value="/admin/changeRole/${user.id}" />
                     <form:form class="form-signin" name="formChangeRoleUser"
                                action="${changeRoleUser}" method="POST"
                                modelAttribute="bindableRole"
                                commandName="bindableRole">
                                                     
                        <form:select path="name" type="select">
                            <c:forEach var="role" items="${roles}">
                                <form:option value="${role.id}">${role.name}</form:option>
                            </c:forEach>      
                        </form:select>                                
                                
                        <button type="submit" class="btn btn-primary">Change user role</button>                        
                     </form:form>   
                </c:if> 
                </div>			   
			</sec:authorize>
	       <br />
		</div>
		<div class="media">
			<b>Name:</b> ${profile.name}<br /> 
			<b>SurNames:</b> ${profile.surnames}<br /> 
			<b>Gender:</b> ${profile.gender}<br /> 
			<b>BirthDay:</b> ${profile.birthDay}<br />
		</div>
	</div>

    
</div>